// Copyright (c) 2016, Open DICOMweb Project. All rights reserved.
// Use of this source code is governed by the open source license
// that can be found in the LICENSE file.
// Author: Jim Philbin <jfphilbin@gmail.edu> -
// See the AUTHORS file for other contributors.

// **** Note: this file cannot have any dependencies on dart:io or dart:html.

//TODO: add a createFMI method to convert writer that uses the system object
//      to generate the new FMI.

// System imports
//  1. uses uid for transfer syntax TODO: anything else?
//  2. uses uuid for random uid generation TODO: finish organization
//  3. Uses version for system version info
//  4. Uses logging to be the root of Logger


//TODO: add a createFMI method to convert writer that uses the system object
//      to generate the new FMI.

//TODO: add a way to log to a file called <project>/output/<script>.out

import 'package:dicom_core/core.dart';

const String kSystemBuildNumber = '00000';

/// The minimum Epoch Year using a 63-bit integer as microseconds.
//const int kMinYearLimit = -144169;

/// The maximum Epoch Year using a 63-bit integer as microseconds.
//const int kMaxYearLimit = 148108;

/// An abstract class that is the foundation of both Servers and Clients.
class System {
  static System get system => _system??System();
  static System? _system;
  // ignore: unnecessary_getters_setters
  static set system(System system) => _system ??= system;
  final Logger log=Logger();

  TransferSyntax get defaultTransferSyntax => TransferSyntax.kExplicitVRLittleEndian;
}

class Logger {
  info(ss){
    print(ss);
  }
  info0(ss){
    print(ss);
  }
  info1(ss){
    print(ss);
  }
  debug(ss,[s1]){
    print(ss);
  }
  debug1(ss){
    print(ss);
  }
  debug2(ss){
    print(ss);
  }
  warn(ss){
    print(ss);
  }

  error(ss){
    print(ss);
  }
  down(){}
  up(){}
}

/// The system singleton;
final System system = System.system;

//Urgent Jim: out how to handle Hash64
/// The system hash function
//int hash(Object o) => system.hash(o);

/// The top-level [Logger] for the src.
Logger get log => system.log;

/// Should functions throw or return null.
bool get throwOnError => false;

/// Should [Uuid] [String]s use upper or lowercase hexadecimal.
bool get uuidsUseUppercase => false;

bool get hexUseUppercase =>false;
